doctype html
html(lang='en')
  head
    meta(charset="utf-8")
    meta(name="viewport", content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no")
    title Mongoose v#{package.version}: #{title}
    include ./includes/favicon
    block style

      link(rel="stylesheet", href="https://unpkg.com/purecss@1.0.1/build/pure-min.css", integrity="sha384-oAOxQR6DkCoMliIh8yFnu25d7Eq/PHS21PClpwjOTeU2jRSq11vu66rf90/cZr47", crossorigin="anonymous")

      link(rel="stylesheet", href="https://fonts.googleapis.com/css?family=Open+Sans")
      link(rel="stylesheet", href=`${versions.versionedPath}/docs/css/mongoose5.css?v=${Date.now()}`)
      link(rel="stylesheet", href=`${versions.versionedPath}/docs/css/github.css?v=${Date.now()}`)
      link(rel="stylesheet", href=`${versions.versionedPath}/docs/css/carbonads.css`)
      link(rel="stylesheet", href=`${versions.versionedPath}/docs/css/copy-code.css`)


      meta(name='msapplication-TileColor', content='#ffffff')
      meta(name='msapplication-TileImage', content=`${versions.versionedPath}/docs/images/favicon/ms-icon-144x144.png`)
      meta(name='theme-color', content='#ffffff')

  body
    block layout
      #layout
        #theme-toggle
          button#theme-toggle-btn(aria-label="Toggle dark mode" title="Toggle dark/light theme")
            <svg id="theme-icon-light" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="5"/><path d="M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"/></svg>
            <svg id="theme-icon-dark" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>
        #mobile-menu
          a#menuLink.menu-link(href='#menu')
            <svg width="100%" height="100%" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg>
          #mobile-logo-container
            a(href="/")
              img#logo(src=`${versions.versionedPath}/docs/images/mongoose5_62x30_transparent.png`)
              span.logo-text mongoose
        #menu
          nav.pure-menu
            #logo-container.pure-menu-heading
              a(href="/")
                img#logo(src=`${versions.versionedPath}/docs/images/mongoose5_62x30_transparent.png`)
                span.logo-text mongoose
            ul.pure-menu-list#navbar
              li.pure-menu-horizontal.pure-menu-item.pure-menu-has-children.pure-menu-allow-hover.version
                a(href=`${versions.versionedPath}/docs/index.html`).pure-menu-link Version #{versions.currentVersion.listed}
                ul.pure-menu-children
                  - if (versions.currentVersion.listed !== versions.latestVersion.listed)
                    li.pure-menu-item
                      a.pure-menu-link(href=`${versions.latestVersion.path}/docs/index.html`) Version #{versions.latestVersion.listed}
                  each pastVersion in versions.pastVersions
                    li.pure-menu-item
                      a.pure-menu-link(href=`/docs/${pastVersion.path}/index.html`) Version #{pastVersion.listed}
              li.pure-menu-item.search
                input#search-input-nav(type="text", placeholder="Search")
                button#search-button-nav
                  img(src=`${versions.versionedPath}/docs/images/search.svg`)
              li.pure-menu-item
                a.pure-menu-link(href=`${versions.versionedPath}/docs/index.html`, class=outputUrl === `${versions.versionedPath}/docs/index.html` ? 'selected' : '') Quick Start
              li.pure-menu-item
                a.pure-menu-link(href=`${versions.versionedPath}/docs/guides.html`, class=outputUrl === `${versions.versionedPath}/docs/guides.html` ? 'selected' : '') Guides
                ul.pure-menu-list
                  li.pure-menu-item.sub-item
                    a.pure-menu-link(href=`${versions.versionedPath}/docs/guide.html`, class=outputUrl === `${versions.versionedPath}/docs/guide.html` ? 'selected' : '') Schemas
                  li.pure-menu-item.sub-item
                    a.pure-menu-link(href=`${versions.versionedPath}/docs/schematypes.html`, class=outputUrl === `${versions.versionedPath}/docs/schematypes.html` ? 'selected' : '') SchemaTypes
                  li.pure-menu-item.sub-item
                    a.pure-menu-link(href=`${versions.versionedPath}/docs/connections.html`, class=outputUrl === `${versions.versionedPath}/docs/connections.html` ? 'selected' : '') Connections
                    - if ([`${versions.versionedPath}/docs/connections`, `${versions.versionedPath}/docs/tutorials/ssl`].some(path => outputUrl.startsWith(path)))
                      ul.pure-menu-list
                        li.pure-menu-item.sub-item
                          a.pure-menu-link(href=`${versions.versionedPath}/docs/tutorials/ssl.html`, class=outputUrl === `${versions.versionedPath}/docs/tutorials/ssl.html` ? 'selected' : '') TLS/SSL Connections
                  li.pure-menu-item.sub-item
                    a.pure-menu-link(href=`${versions.versionedPath}/docs/models.html`, class=outputUrl === `${versions.versionedPath}/docs/models.html` ? 'selected' : '') Models
                    - if ([`${versions.versionedPath}/docs/models`, `${versions.versionedPath}/docs/change-streams`].some(path => outputUrl.startsWith(path)))
                      ul.pure-menu-list
                        li.pure-menu-item.sub-item
                          a.pure-menu-link(href=`${versions.versionedPath}/docs/change-streams.html`, class=outputUrl === `${versions.versionedPath}/docs/change-streams.html` ? 'selected' : '') Change Streams
                  li.pure-menu-item.sub-item
                    a.pure-menu-link(href=`${versions.versionedPath}/docs/documents.html`, class=outputUrl === `${versions.versionedPath}/docs/documents.html` ? 'selected' : '') Documents
                  li.pure-menu-item.sub-item
                    a.pure-menu-link(href=`${versions.versionedPath}/docs/subdocs.html`, class=outputUrl === `${versions.versionedPath}/docs/subdocs.html` ? 'selected' : '') Subdocuments
                  li.pure-menu-item.sub-item
                    a.pure-menu-link(href=`${versions.versionedPath}/docs/queries.html`, class=outputUrl === `${versions.versionedPath}/docs/queries.html` ? 'selected' : '') Queries
                    - if ([`${versions.versionedPath}/docs/queries`, `${versions.versionedPath}/docs/tutorials/findoneandupdate`, `${versions.versionedPath}/docs/tutorials/lean`, `${versions.versionedPath}/docs/tutorials/query_casting`].some(path => outputUrl.startsWith(path)))
                      ul.pure-menu-list
                        li.pure-menu-item.sub-item
                          a.pure-menu-link(href=`${versions.versionedPath}/docs/tutorials/query_casting.html`, class=outputUrl === `${versions.versionedPath}/docs/tutorials/query_casting.html` ? 'selected' : '') Query Casting
                        li.pure-menu-item.sub-item
                          a.pure-menu-link(href=`${versions.versionedPath}/docs/tutorials/findoneandupdate.html`, class=outputUrl === `${versions.versionedPath}/docs/tutorials/findoneandupdate.html` ? 'selected' : '') findOneAndUpdate
                        li.pure-menu-item.sub-item
                          a.pure-menu-link(href=`${versions.versionedPath}/docs/tutorials/lean.html`, class=outputUrl === `${versions.versionedPath}/docs/tutorials/lean.html` ? 'selected' : '') The Lean Option
                  li.pure-menu-item.sub-item
                    a.pure-menu-link(href=`${versions.versionedPath}/docs/validation.html`, class=outputUrl === `${versions.versionedPath}/docs/validation.html` ? 'selected' : '') Validation
                  li.pure-menu-item.sub-item
                    a.pure-menu-link(href=`${versions.versionedPath}/docs/middleware.html`, class=outputUrl === `${versions.versionedPath}/docs/middleware.html` ? 'selected' : '') Middleware
                  li.pure-menu-item.sub-item
                    a.pure-menu-link(href=`${versions.versionedPath}/docs/populate.html`, class=outputUrl === `${versions.versionedPath}/docs/populate.html` ? 'selected' : '') Populate
                  li.pure-menu-item.sub-item
                    a.pure-menu-link(href=`${versions.versionedPath}/docs/discriminators.html`, class=outputUrl === `${versions.versionedPath}/docs/discriminators.html` ? 'selected' : '') Discriminators
                  li.pure-menu-item.sub-item
                    a.pure-menu-link(href=`${versions.versionedPath}/docs/plugins.html`, class=outputUrl === `${versions.versionedPath}/docs/plugins.html` ? 'selected' : '') Plugins
                  li.pure-menu-item.sub-item
                    a.pure-menu-link(href=`${versions.versionedPath}/docs/timestamps.html`, class=outputUrl === `${versions.versionedPath}/docs/timestamps.html` ? 'selected' : '') Timestamps
                  li.pure-menu-item.sub-item
                    a.pure-menu-link(href=`${versions.versionedPath}/docs/transactions.html`, class=outputUrl === `${versions.versionedPath}/docs/transactions.html` ? 'selected' : '') Transactions
                  li.pure-menu-item.sub-item
                    a.pure-menu-link(href=`${versions.versionedPath}/docs/typescript.html`, class=outputUrl === `${versions.versionedPath}/docs/typescript.html` ? 'selected' : '') TypeScript
                    - if (outputUrl.startsWith(`${versions.versionedPath}/docs/typescript`))
                      ul.pure-menu-list
                        li.pure-menu-item.sub-item
                          a.pure-menu-link(href=`${versions.versionedPath}/docs/typescript/schemas.html`, class=outputUrl === `${versions.versionedPath}/docs/typescript/schemas.html` ? 'selected' : '') Schemas
                        li.pure-menu-item.sub-item
                          a.pure-menu-link(href=`${versions.versionedPath}/docs/typescript/statics-and-methods.html`, class=outputUrl === `${versions.versionedPath}/docs/typescript/statics-and-methods.html` ? 'selected' : '') Statics and Methods
                        li.pure-menu-item.sub-item
                          a.pure-menu-link(href=`${versions.versionedPath}/docs/typescript/queries.html`, class=outputUrl === `${versions.versionedPath}/docs/typescript/queries.html` ? 'selected' : '') Queries
                        li.pure-menu-item.sub-item
                          a.pure-menu-link(href=`${versions.versionedPath}/docs/typescript/query-helpers.html`, class=outputUrl === `${versions.versionedPath}/docs/typescript/query-helpers.html` ? 'selected' : '') Query Helpers
                        li.pure-menu-item.sub-item
                          a.pure-menu-link(href=`${versions.versionedPath}/docs/typescript/populate.html`, class=outputUrl === `${versions.versionedPath}/docs/typescript/populate.html` ? 'selected' : '') Populate
                        li.pure-menu-item.sub-item
                          a.pure-menu-link(href=`${versions.versionedPath}/docs/typescript/virtuals.html`, class=outputUrl === `${versions.versionedPath}/docs/typescript/virtuals.html` ? 'selected' : '') Virtuals
                        li.pure-menu-item.sub-item
                          a.pure-menu-link(href=`${versions.versionedPath}/docs/typescript/subdocuments.html`, class=outputUrl === `${versions.versionedPath}/docs/typescript/subdocuments.html` ? 'selected' : '') Subdocuments
              li.pure-menu-item
                a.pure-menu-link(href=`${versions.versionedPath}/docs/api/mongoose.html`, class=outputUrl === `${versions.versionedPath}/docs/api/mongoose.html` ? 'selected' : '') API
                ul.pure-menu-list
                  li.pure-menu-item.sub-item
                    a.pure-menu-link(href=`${versions.versionedPath}/docs/api/mongoose.html`, class=outputUrl === `${versions.versionedPath}/docs/api/mongoose.html` ? 'selected' : '') Mongoose
                  li.pure-menu-item.sub-item
                    a.pure-menu-link(href=`${versions.versionedPath}/docs/api/schema.html`, class=outputUrl === `${versions.versionedPath}/docs/api/schema.html` ? 'selected' : '') Schema
                  li.pure-menu-item.sub-item
                    a.pure-menu-link(href=`${versions.versionedPath}/docs/api/connection.html`, class=outputUrl === `${versions.versionedPath}/docs/api/connection.html` ? 'selected' : '') Connection
                  li.pure-menu-item.sub-item
                    a.pure-menu-link(href=`${versions.versionedPath}/docs/api/document.html`, class=outputUrl === `${versions.versionedPath}/docs/api/document.html` ? 'selected' : '') Document
                  li.pure-menu-item.sub-item
                    a.pure-menu-link(href=`${versions.versionedPath}/docs/api/model.html`, class=outputUrl === `${versions.versionedPath}/docs/api/model.html` ? 'selected' : '') Model
                  li.pure-menu-item.sub-item
                    a.pure-menu-link(href=`${versions.versionedPath}/docs/api/query.html`, class=outputUrl === `${versions.versionedPath}/docs/api/query.html` ? 'selected' : '') Query
                  li.pure-menu-item.sub-item
                    a.pure-menu-link(href=`${versions.versionedPath}/docs/api/aggregate.html`, class=outputUrl === `${versions.versionedPath}/docs/api/aggregate.html` ? 'selected' : '') Aggregate
                  li.pure-menu-item.sub-item
                    a.pure-menu-link(href=`${versions.versionedPath}/docs/api/schematype.html`, class=outputUrl === `${versions.versionedPath}/docs/api/schematype.html` ? 'selected' : '') SchemaType
                  li.pure-menu-item.sub-item
                    a.pure-menu-link(href=`${versions.versionedPath}/docs/api/virtualtype.html`, class=outputUrl === `${versions.versionedPath}/docs/api/virtualtype.html` ? 'selected' : '') VirtualType
              li.pure-menu-item
                a.pure-menu-link(href=`${versions.versionedPath}/docs/migrating_to_9.html`, class=outputUrl === `${versions.versionedPath}/docs/migrating_to_9.html` ? 'selected' : '') Migration Guide
              li.pure-menu-item
                a.pure-menu-link(href=`${versions.versionedPath}/docs/compatibility.html`, class=outputUrl === `${versions.versionedPath}/docs/compatibility.html` ? 'selected' : '') Version Compatibility
              li.pure-menu-item
                a.pure-menu-link(href=`${versions.versionedPath}/docs/version-support.html`, class=outputUrl === `${versions.versionedPath}/docs/version-support.html` ? 'selected' : '') Version Support
              li.pure-menu-item
                a.pure-menu-link(href=`${versions.versionedPath}/docs/faq.html`, class=outputUrl === `${versions.versionedPath}/docs/faq.html` ? 'selected' : '') FAQ
              li.pure-menu-item
                a.pure-menu-link(href=`${versions.versionedPath}/docs/further_reading.html`, class=outputUrl === `${versions.versionedPath}/docs/further_reading.html` ? 'selected' : '') Further Reading
              li.pure-menu-item
                a.pure-menu-link(href=`${versions.versionedPath}/docs/enterprise.html`, class=outputUrl === `${versions.versionedPath}/docs/enterprise.html` ? 'selected' : '') For Enterprise
              li.pure-menu-item
                a.pure-menu-link(href=`${versions.versionedPath}/docs/sponsors.html`, , class=outputUrl === `${versions.versionedPath}/docs/sponsors.html` ? 'selected' : '') Sponsors
            div.cpc-ad
              <script async type="text/javascript" src="//cdn.carbonads.com/carbon.js?zoneid=1673&serve=C6AILKT&placement=mongoosejscom" id="_carbonads_js"></script>
        .container
          #content
            block content

        - if (!outputUrl.startsWith(`${versions.versionedPath}/docs/jobs.html`))
          div#jobs
            each job in jobs
              .job-listing
                a(href=`${versions.versionedPath}/docs/jobs.html#` + job._id)
                  .company-logo
                    img(src=job.logo)
                  .description
                    .company #{job.company}
                    .title #{job.title}
                    .location #{job.location}
            .button.jobs-view-more
              a(href=`${versions.versionedPath}/docs/jobs.html`) View more jobs!

        script(type="text/javascript" src=`${versions.versionedPath}/docs/js/navbar-search.js`)
        script(type="text/javascript" src=`${versions.versionedPath}/docs/js/mobile-navbar-toggle.js`)
        script(type="text/javascript" src=`${versions.versionedPath}/docs/js/theme-toggle.js`)

        script(type="text/javascript" src=`${versions.versionedPath}/docs/js/copy-code.js`)
